<template>
    <div>
        123
    </div>
</template>
<script setup>

import { useApi } from '@/composable/useApi'
const { TrainSolutionsActSearch } = useApi("TrainSolutionsAct");
const { CaSignLogSearch } = useApi("CaSignLog");




const myFrom = new FormData();
myFrom.append("begin", "0");
myFrom.append("rows", "2001");
// TrainSolutionsActSearch({
//     begin:0,
//     rows:20,
// }).then(res=>{
//         console.log(res);
// })

const imgstr = ``
const dataURLtoBlob = (dataurl) => {
    var arr = dataurl.split(','),
        mime = arr[0].match(/:(.*?);/)[1],
        bstr = atob(arr[1]),
        n = bstr.length,
        u8arr = new Uint8Array(n);
    while (n--) {
        u8arr[n] = bstr.charCodeAt(n);
    }
    return new Blob([u8arr], { type: mime });
}
//2,再将blob转换为file
const blobToFile = (theBlob, fileName) => {
    theBlob.lastModifiedDate = new Date();  // 文件最后的修改日期
    theBlob.name = fileName;                // 文件名
    return new File([theBlob], fileName, { type: theBlob.type, lastModified: Date.now() });
}
const file = blobToFile(dataURLtoBlob(imgstr), "1.png")
console.log(file)

myFrom.append("file", file)
myFrom.append("ids", ["1", "2", "3"])

const obj = {
    begin: 0,
    rows: 20,
    ids: ["1", "2", "3"],
    file: file
}
CaSignLogSearch(obj)
</script>
<style scoped>

</style>